jQuery(document).on("pageinit", "[data-role='page'][data-pagetype='infolist']", function() {
    var page = jQuery(this);
    var category = get_url_params(page.jqmData("url"), "category");
    var _infolist_render = this;
    var url_info_swipeshow_items = URL_ACTION_NEWS_SWIPESHOW_ITEMS;
    var url_info_list_items = URL_ACTION_INFO_LIST_ITEMS;

    var info_swipeshow_render = jQuery.extend(true, {}, swipeshow_render, {
        components:{
            page: page,
            slider: page.find("#slider"),
            slider_nav: page.find("#slider_nav"),
        },

        handler: function(items){
            swipeshow_render.handler.call(info_swipeshow_render, items);
        },
    });

    var info_listview_render = jQuery.extend(true, {}, listview_render, {
        handler: function(items){
            listview_render.handler.call(info_listview_render, items);
        },

        components: {
            page: page,
            ul: page.find("div[data-role='content']").find("div.con_padding").find("ul[data-role='listview']")
        },

        gen_listview_item: function(item){
            return "<li data-icon='false' data-itemid='"+ item.id+"'>" +
                "<a href='"+URL_VIEW_INFO_CONTENT+"?id="+item.id+"' data-role='button' data-transition='slide'>"+
                "<img class='ui-li-thumb' src='data:image/jpeg;base64," + item.thumbnail + "'/>" + 
                "<h2>"+item.name+"</h2>"+
                "<p>"+item.desc+"</p>" +
                "</a>"+
                "</li>";
        }
    });

    jQuery(".iscroll-wrapper", _infolist_render).bind({
        "iscroll_onpulldown" : function(event, data){
            if(info_listview_render.pull_down){
                var params = {
                    offset: info_listview_render.components.ul.children("li:first").jqmData("itemid") || 0,
                    action: "down"
                };
                info_listview_render.pull_down(url_info_list_items, params);
            }
        },

        "iscroll_onpullup"   :  function(event, data){
            if(info_listview_render.pull_up){
                var params = {
                    offset: info_listview_render.components.ul.children("li:last").jqmData("itemid") || 0,
                    action: "up"
                };
                info_listview_render.pull_up(url_info_list_items, params);
            }
        }
    });

    info_swipeshow_render.render(url_info_swipeshow_items, {});
    info_listview_render.render(url_info_list_items, {category:category});
});

